package web.fabrimind.mwm.service.impl;

import java.util.List;
import web.fabrimind.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web.fabrimind.mwm.mapper.MaterialInventoryMapper;
import web.fabrimind.mwm.domain.MaterialInventory;
import web.fabrimind.mwm.service.IMaterialInventoryService;

/**
 * 物料库存Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-28
 */
@Service
public class MaterialInventoryServiceImpl implements IMaterialInventoryService 
{
    @Autowired
    private MaterialInventoryMapper materialInventoryMapper;

    /**
     * 查询物料库存
     * 
     * @param inventoryId 物料库存主键
     * @return 物料库存
     */
    @Override
    public MaterialInventory selectMaterialInventoryByInventoryId(Long inventoryId)
    {
        return materialInventoryMapper.selectMaterialInventoryByInventoryId(inventoryId);
    }

    /**
     * 查询物料库存列表
     * 
     * @param materialInventory 物料库存
     * @return 物料库存
     */
    @Override
    public List<MaterialInventory> selectMaterialInventoryList(MaterialInventory materialInventory)
    {
        return materialInventoryMapper.selectMaterialInventoryList(materialInventory);
    }

    /**
     * 新增物料库存
     * 
     * @param materialInventory 物料库存
     * @return 结果
     */
    @Override
    public int insertMaterialInventory(MaterialInventory materialInventory)
    {
        materialInventory.setCreateTime(DateUtils.getNowDate());
        return materialInventoryMapper.insertMaterialInventory(materialInventory);
    }

    /**
     * 修改物料库存
     * 
     * @param materialInventory 物料库存
     * @return 结果
     */
    @Override
    public int updateMaterialInventory(MaterialInventory materialInventory)
    {
        materialInventory.setUpdateTime(DateUtils.getNowDate());
        return materialInventoryMapper.updateMaterialInventory(materialInventory);
    }

    /**
     * 批量删除物料库存
     * 
     * @param inventoryIds 需要删除的物料库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInventoryByInventoryIds(Long[] inventoryIds)
    {
        return materialInventoryMapper.deleteMaterialInventoryByInventoryIds(inventoryIds);
    }

    /**
     * 删除物料库存信息
     * 
     * @param inventoryId 物料库存主键
     * @return 结果
     */
    @Override
    public int deleteMaterialInventoryByInventoryId(Long inventoryId)
    {
        return materialInventoryMapper.deleteMaterialInventoryByInventoryId(inventoryId);
    }


    /**
     * 查询物料列表（不分页）
     */
    @Override
    public List<MaterialInventory> selectMaterialList(MaterialInventory materialInventory) {
        return materialInventoryMapper.selectMaterialList(materialInventory);
    }

    /**
     * 查询仓库列表（不分页）
     */
    @Override
    public List<MaterialInventory> selectWarehouseList(MaterialInventory materialInventory) {
        return materialInventoryMapper.selectWarehouseList(materialInventory);
    }

    /**
     * 查询库位列表（不分页）
     */
    @Override
    public List<MaterialInventory> selectLocationList(MaterialInventory materialInventory) {
        return materialInventoryMapper.selectLocationList(materialInventory);
    }

    /**
     * 查询批次列表（不分页）
     */
    @Override
    public List<MaterialInventory> selectBatchList(MaterialInventory materialInventory) {
        return materialInventoryMapper.selectBatchList(materialInventory);
    }
}
